$(function () {
    var removeHistory_datagrid = $("#removeHistory_datagrid");
    var rems_dialog = $("#rems_dialog");
    var rems_form = $("#rems_form");
    removeHistory_datagrid.datagrid({
        url: '/removeHistory/query.do',
        fit: true,
        fitColumns: true,
        columns: [[
            {field: 'name', title: '用户名', width: 100},
            {field: 'qq', title: 'QQ', width: 100},
            {field: 'tel', title: '联系电话', width: 100},
            {field: 'hirdate', title: '日期', width: 100},
            {field: 'rowUser', title: '原拥有者', width: 100,formatter:function (value) {
                return value.username;
            }},
            {field: 'moveUser', title: '移交目标', width: 100,formatter:function (value) {
                return value.username;
            }}
        ]],
        singleSelect: true,
        pagination: true,
        toolbar: "#rems_btns",
        sortName: 'hireDate'
    });
    rems_dialog.dialog({
        width: 300,
        height: 400,
        buttons: "#save_btns",
        closed: true,
        onClose: function () {
            rems_form.form('clear');
        }
    });
    $("a[data-cmd]").click(function () {
        var methodName = $(this).data('cmd');
        methodObject[methodName]();
    })
    var methodObject = {
        reload: function () {
            removeHistory_datagrid.datagrid('reload');
        },
        query: function () {
            var clientName = $("#clientName").val();
            $.post('/removeHistory/query.do',{clientName:clientName},function (data) {
                removeHistory_datagrid.datagrid('loadData',data);
            })
        },
    }
})


